package com.timepies.button;

import java.util.ArrayList;

import android.app.ActionBar;

import com.timepies.ElencoPieActivity;
import com.timepies.R;
import com.timepies.domain.SpinnerNavAdapter;
import com.timepies.domain.SpinnerNavItem;

public class Dropdown {

	public static ActionBar addTo(ElencoPieActivity activity) {

		ActionBar actionBar = activity.getActionBar();

		// Hide the action bar title
		actionBar.setDisplayShowTitleEnabled(false);

		// Enabling Spinner dropdown navigation
		actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

		// Spinner title navigation data
		ArrayList<SpinnerNavItem> navSpinner = new ArrayList<SpinnerNavItem>();
		navSpinner.add(new SpinnerNavItem("TIMEPIES", R.drawable.ic_launcher));
		navSpinner.add(new SpinnerNavItem("FERIE", R.drawable.ic_launcher));
		navSpinner.add(new SpinnerNavItem("PONTI LAVORATIVI",
				R.drawable.ic_launcher));

		// title drop down adapter
		SpinnerNavAdapter adapter = new SpinnerNavAdapter(activity, navSpinner);

		actionBar.setListNavigationCallbacks(adapter, activity);

		return actionBar;

	}
}
